package games;
import java.util.Random;
import java.util.Scanner;
public class game {

    static int a = 0;
    static int b = 0;

        public static void main(String[] args) {
        System.out.println("我们来玩石头剪刀布的小游戏吧！");
        System.out.println("1、剪刀   2、石头   3、布");
        Scanner SC = new Scanner(System.in);
        for (int i = 1; i <= 5; ++i) {
            System.out.println("第1局："+i);
            System.out.println("你出的是：");
            String choose = SC.next();
            int num = new Random().nextInt(3) + 1;
            if (choose.equals("剪刀")) {
                if (num == 1) {
                    System.out.println("电脑出的是：剪刀");
                    System.out.println("旗鼓相当，平局！");
                    b++;
                } else if (num == 2) {
                    System.out.println("电脑出的是：石头");
                    System.out.println("很抱歉，你输了！");
                } else {
                    System.out.println("电脑出的是：布");
                    System.out.println("恭贺，你赢了！");
                    a++;
                }
            } else if (choose.equals("石头")) {
                if (num == 1) {
                    System.out.println("电脑出的是：剪刀");
                    System.out.println("恭贺，你赢了！");
                    a++;
                } else if (num == 2) {
                    System.out.println("电脑出的是：石头");
                    System.out.println("旗鼓相当，平局！");
                    b++;
                } else {
                    System.out.println("电脑出的是：剪刀");
                    System.out.println("很抱歉，你输了！");
                }
            } else if (choose.equals("布")) {
                if (num == 1) {
                    System.out.println("电脑出的是：剪刀");
                    System.out.println("很抱歉，你输了！");
                } else if (num == 2) {
                    System.out.println("电脑出的是：石头");
                    System.out.println("恭贺，你赢了！");
                    a++;
                } else {
                    System.out.println("电脑出的是：布");
                    System.out.println("旗鼓相当，平局！");
                    b++;
                }
            }
        }
        int c = 5 - a - b;
        System.out.println("本次游戏您赢了" + a + "局，" + "平了" + b + "局");
        System.out.println("电脑赢了" + c + "局");
        if (a == c) {
            System.out.println("诶呀，我们是平局诶！");
        } else if (a > b) {
            System.out.println("还是你厉害呢，恭喜，最后的赢家！");
        } else System.out.println("最终还是你输了！");
        }
}
